<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" > 
    <head>
        <title><?php echo strip_tags($title); ?></title>
        <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset; ?>" />
        <!--[if lt IE 9]>
            <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->

        <?php foreach ($css as $url): ?>
            <link rel="stylesheet" type="text/css" media="screen" href="<?php echo $url; ?>" />
        <?php endforeach; ?>

    </head>

    <body>
        <?php foreach ($js as $url): ?>
            <script type="text/javascript" src="<?php echo $url; ?>"></script> 
        <?php endforeach; ?>

        <section>
            <div class="space"></div>
            <div id="container" class="container_12">
                <header>
                    <div class="grid_4">
                        <a href="<?php echo base_url(''); ?>"><img src="<?= base_url("assets/images/logo.png"); ?>"></a>
                        <h1><a href="<?php echo base_url(''); ?>">PlastProd</a></h1>
                        <p>Le plastique dans tous ses états !</p>
                    </div>
                    <div class="grid_4">
                        <h2>Vos notifications</h2>
                        <p>Aucun message.</p>
                    </div>
                    <div class="grid_4 notif">

                        <?php echo (isset($this->session->userdata['USR_ID'])) ? '<h2>' . ($this->session->userdata['USR_FIRST_NAME'] . ' ' . $this->session->userdata['USR_LAST_NAME']) . '</h2>' : ''; ?>
                        <?php echo (isset($this->session->userdata['USR_ID'])) ? '<p>' . $this->session->userdata['USR_EMAIL'] . '</p><br>' : ''; ?>
                        <p style="padding-top: 5px;">
                            <?php echo (isset($this->session->userdata['USR_ID'])) ? '<a href="' . base_url('account/logout') . '">Se déconnecter</a>' : '<a href="' . base_url('account/login') . '">Authentification</a>'; ?>
                        </p>
                    </div>
                </header>
                <section>

                    <?php
                    if (isset($alertText)) {
                        echo '<script type="text/javascript">alert(\'' . $alertText . '\', \'' . $alertType . '\');</script>';
                    }
                    ?>

                    <div class="grid_3 sidebar">
                        <div class="navigation">
                            <div class="header">
                                <a href="<?= base_url() ?>"><div class="img"></div></a>
                                <p>PlastProd</p>
                                <?php if (isset($this->session->userdata['utilisateur_id'])) { ?>
                                    <span><a href="<?= base_url() ?>Profil">Mon profil</a></span>
                                <? } else { ?>
                                    Veuillez vous authentifier...
                                <?php } ?>
                            </div>
                            <div class="content">
                                <ul class="menu">
                                    <?php
                                    foreach ($menus AS $menu) {
                                        echo '<li class="item_container" id="' . $menu['id'] . '">';
                                        echo '<a href="#" class="navTitle">' . $menu['name'] . '</a>';
                                        echo '<ul class="submenu">';

                                        foreach ($menu['links'] AS $link) {
                                            echo '<li id="' . $link['id'] . '"><a href="' . base_url($link['link']) . '">&nbsp; &nbsp; ➔ ' . $link['name'] . '</a></li>';
                                        }
                                        echo '</ul></li>';

                                        //
                                    }
                                    ?>
                                    <?php if (isset($this->session->userdata['USR_ID'])) { ?>
                                        <li class="item_container" id="Administration">
                                            <a href="#" class="navTitle">Administration</a>

                                            <ul class="submenu">
                                                <li class="none">Gestion générale</li>

                                                <li id="Utilisateurs"><a href="<?= base_url() ?>Administration/Utilisateurs">&nbsp; &nbsp; ➔ Utilisateurs</a></li>
                                                <li id="Groupes_utilisateurs"><a href="<?= base_url() ?>Administration/Groupes_utilisateurs">&nbsp; &nbsp; ➔ Groupes utilisateurs</a></li>
                                                <li id="Droits"><a href="<?= base_url() ?>Administration/Droits">&nbsp; &nbsp; ➔ Droits d'accès</a></li>
                                                <li id="Societes"><a href="<?= base_url() ?>Administration/Societes">&nbsp; &nbsp; ➔ Sociétés</a></li>
                                                <li id="Types_societes"><a href="<?= base_url() ?>Administration/Types_societes">&nbsp; &nbsp; ➔ Types de sociétés</a></li>

                                                <li class="none">Gestion de la production</li>
                                                <li id="Processus_lignes_production"><a href="<?= base_url() ?>Administration/Processus_lignes_production">&nbsp; &nbsp; ➔ Processus de Ligne de Production</a></li>
                                                <li id="Lignes_production"><a href="<?= base_url() ?>Administration/Lignes_production">&nbsp; &nbsp; ➔ Lignes de Production</a></li>
                                                <li id="Chaines_production"><a href="<?= base_url() ?>Administration/Chaines_production">&nbsp; &nbsp; ➔ Chaînes de production</a></li>
                                                <li id="Etat_chaines_production"><a href="<?= base_url() ?>Administration/Etat_chaines_production">&nbsp; &nbsp; ➔ Etats des chaînes de prod</a></li>
                                            </ul>
                                        </li>
                                    <?php } ?>
                                    <?php if (isset($this->session->userdata['USR_ID'])) { ?>
                                        <li class="item_container" id="Magasinier">
                                            <a href="#" class="navTitle">Module Production</a>

                                            <!--  User avec le droit PRODUCTION -->

                                            <ul class="submenu">
                                                <li class="none">Production</li>
                                                <li id="Gestion_Bat"><a href="<?= base_url() ?>Production/Gestion_Bat">&nbsp; &nbsp; ➔ Gestion des B.A.T.</a></li>
                                                <li id="Gestion_Baj"><a href="<?= base_url() ?>Production/Gestion_Baj">&nbsp; &nbsp; ➔ Gestion des B.A.J.</a></li>
                                                <li id="Gestion_CodeBarre"><a href="<?= base_url() ?>Production/Gestion_CodeBarre">&nbsp; &nbsp; ➔ Gestion des Codes Barre</a></li>
                                            <?php } ?>

                                            <!--  User avec le droit MAGASIN -->
                                            <?php if (isset($this->session->userdata['USR_ID'])) { ?>
                                                <li class="none">Magasinier</li>
                                                <li id="Familles"><a href="<?= base_url() ?>Magasinier/Familles">&nbsp; &nbsp; ➔ Famille de Produits</a></li>
                                                <li id="Produits"><a href="<?= base_url() ?>Magasinier/Produits">&nbsp; &nbsp; ➔ Gestion des Produits</a></li>
                                                <li id="Expeditions"><a href="<?= base_url() ?>Magasinier/Expeditions">&nbsp; &nbsp; ➔ Gestion des Expéditions (?)</a></li>
                                            </ul>
                                        <?php } ?>
                                    </li>				

                                    <?php if (isset($this->session->userdata['USR_ID'])) { ?>
                                        <li class="item_container" id="Commercial">
                                            <a href="#" class="navTitle">Service Commercial</a>
                                            <ul class="submenu">
                                                <li id="Clients"><a href="<?= base_url() ?>Commercial/Clients">&nbsp; &nbsp; ➔ Gestion des Clients</a></li>
                                                <li id="Produits"><a href="<?= base_url() ?>Commercial/Produits">&nbsp; &nbsp; ➔ Gestion des Produits</a></li>
                                                <li id="Commandes"><a href="<?= base_url() ?>Commercial/Commandes">&nbsp; &nbsp; ➔ Gestion des Commandes</a></li>
                                            </ul>
                                        </li>
                                    <?php } ?>

                                    <li class="item_container" id="Assistance">
                                        <a href="#" class="navTitle">Assistance</a>
                                        <ul class="submenu">
                                            <li id="FAQ"><a href="<?= base_url() ?>Assistance/FAQ">&nbsp; &nbsp; ➔ FAQ</a></li>
                                            <li id="Contact"><a href="<?= base_url() ?>Assistance/Contact">&nbsp; &nbsp; ➔ Contactez nous</a></li>
                                        </ul>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                    <!--[if lt IE 9]>
<script type="application/javascript">
                document.getElementById('<?php echo $this->uri->segment(1); ?>').className = "currentMenu";
                document.getElementById('<?php echo $this->uri->segment(2); ?>').className = "currentSubMenu";
            </script>-->
                    <!-- Navigation -->
                    <div class="grid_9">

                        <p class="ariane">
                            <?php echo $linksHeader; ?>
                        </p>

                        <h1 class="title"><?php echo $title ?></h1>
                        <?php echo $output; ?>

                    </div>
                </section>
                <div class="clear"></div>
                <div class="grid_12">
                    <footer>
                        <p class="footer"><?php echo lang('page_rendered'); ?> <strong>{elapsed_time}</strong><?php echo lang('seconds'); ?></p>
                    </footer>
                </div>
            </div>
    </body>
</html>